﻿using System;
using System.Windows.Forms;
using JellystonePark.Model;

namespace JellystonePark.JellystoneWF.View
{
    public partial class SetupForm : Form
    {
        #region Fields

        private JellystonePlayer _player;

        #endregion

        #region Properties

        public JellystonePlayer Player { get { return _player; } }

        public JellystoneModel.GameDifficulty Difficulty
        {
            get
            {
                if (_radioButtonEasy.Checked)
                    return JellystoneModel.GameDifficulty.Easy;
                if (_radioButtonModerate.Checked)
                    return JellystoneModel.GameDifficulty.Moderate;
                return JellystoneModel.GameDifficulty.Hard;
            }
        }

        public bool UseDefaultLevels { get { return _checkBoxUseDefaultLevels.Checked; } }

        #endregion

        public SetupForm()
        {
            InitializeComponent();
            _player = new JellystonePlayer("");
        }

        private void _buttonOK_Click(object sender, EventArgs e)
        {
            try
            {
                _player.Name = _textBoxPlayerName.Text;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Hiba!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DialogResult = DialogResult.None;
            }
        }
    }
}
